package com.baizhi.syh.service;

import com.baizhi.syh.DAO.CategoryDAO;
import com.baizhi.syh.VO.ResultVO;
import com.baizhi.syh.entity.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CategoryServiceImpl implements CategoryService{

    @Autowired
    private CategoryDAO categoryDAO;


    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    //一级目录分页查询
    public ResultVO selectOneLevels(int pageNumber , int size) {
        int begin = (pageNumber-1)*size;
        ResultVO resultVO = new ResultVO();
        resultVO.setRows(categoryDAO.selectOneCategories(begin,size));
        resultVO.setPage(pageNumber);
        resultVO.setTotal(categoryDAO.selectOneTotal());
        return resultVO;
    }


}
